<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <h:head>
        <title>Insert data</title>
        <h:outputStylesheet name="styles.css" library="css"/>
        <h:outputStylesheet name="grid.css" library="css"/>
        <h:outputStylesheet name="tooltip.css" library="css"/>
        <h:outputStylesheet name="console.css" library="css"/>
    </h:head>
    <h:body>
        <f:view>
            <h:panelGroup id="wrapper" layout="block">
                <ui:include src="/resources/templates/header.xhtml"/>
                <h:panelGroup class="row" layout="block">
                    <h:panelGroup class="sixteen columns white-bg sp-azul" layout="block">
                        <h1 style="margin-left:15px;">New insert into #{controllerWeb.selectedTable} : </h1>
                        <h:panelGroup class="inner-columns overflow row" layout="block">
                            <h:panelGroup class="ten columns" layout="block">
                                <h:form enctype="multipart/form-data">
                                    <ui:repeat value="#{controllerWeb.getInsertForm().entrySet().toArray()}" var="_entry" varStatus="vs">
                                        <h:panelGroup class="label-input" layout="block">
                                            <label>#{_entry.key}</label>
<ui:fragment rendered="#{controllerWeb.tfk.get(_entry.key) != null}">
    <span><h:selectOneMenu value="#{controllerWeb.tbi[_entry.key]}">
        <f:selectItems value="#{controllerWeb.tbi[_entry.key]}" 
                       var="c" 
                       itemValue="#{c}" 
                       itemLabel="#{c}" />
    </h:selectOneMenu>
    </span>
</ui:fragment>
<ui:fragment rendered="#{controllerWeb.tfk.get(_entry.key) == null}">
    <span>
        <h:inputText value="#{controllerWeb.tbi[_entry.key]}"/>
    </span>
</ui:fragment>
                                        </h:panelGroup>
                                    </ui:repeat>
                                    <h:commandButton action="#{controllerWeb.insertContent()}" value="insert"/>
                                </h:form>
                            </h:panelGroup>                 
                            <h:panelGroup class="six columns" layout="block">
                                <ul class="insert-desc">
                                    <ui:repeat value="#{controllerWeb.getTableDesc().entrySet().toArray()}" var="_entry"><ui:fragment rendered="#{_entry.key eq 'Type'}">
                                            <ui:repeat value="#{_entry.value}" var="_list"><li>
                                                    <h:panelGroup class="label-input" layout="block">
                                                        <h:outputText value="#{_list}"/>     
                                                    </h:panelGroup>
                                                </li></ui:repeat>
                                        </ui:fragment>
                                    </ui:repeat>
                                </ul>
                            </h:panelGroup>
                        </h:panelGroup>
                    </h:panelGroup>   
                </h:panelGroup>
                <ui:include src="/resources/templates/footer.xhtml"/>
            </h:panelGroup>
        </f:view>
    </h:body>
</html>

